#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
int* selfDividingNumbers(int left, int right,int* returnSize) {
    int* x = (int*)malloc(sizeof(int) * (right - left + 1));
    int i = 0;
    int num = 0;
    for (i = left; i <= right; i++)
    {
        if (i < 10)
        {
            x[num++] = i;
        }
        else
        {
            int flag = i;
            int w = 0;
            while (flag)
            {
                int y = flag % 10;
                if (y == 0)
                {
                    w = 1;
                }
                else if (i % y != 0)
                {
                    w = 1;
                }
                flag /= 10;
            }
            if (w == 0)
            {
                x[num++] = i;
            }
        }
    }
    *returnSize = num;
    return x;
}

int main()
{
    int* returnSize =NULL;
    int* p=selfDividingNumbers(1, 22,returnSize);
    for (int i = 0; i < *returnSize; i++)
    {
        printf("%d", p[i]);
    }
    return 0;
}